package org.syncsoft.overalt.gui.impl.window.commit;

import javax.swing.JLabel;

import org.syncsoft.overalt.common.api.Resource;
import org.syncsoft.overalt.gui.api.WindowContextValue;
import org.syncsoft.overalt.gui.api.window.AbstractSendFileWindow;
import org.syncsoft.overalt.gui.util.BuildFormWindow;

/**
 * commit window
 * @author tptfc
 *
 */
public class CommitWindow extends AbstractSendFileWindow {
	public CommitWindow(CommitWindowController controller) {
		super(controller);
	}
	
	public CommitWindow(int width, int height, CommitWindowController controller) {
		super(width, height, controller);
	}

	/*
	 * (non-Javadoc)
	 * @see org.syncsoft.overalt.gui.api.window.AbstractSendFileWindow#doBuildWindow(org.syncsoft.overalt.gui.util.BuildFormWindow)
	 */
	@Override
	protected void doBuildWindow(BuildFormWindow build) {
		setTitle(Resource.getProperty("overalt.label.commit"));
		JLabel label = new JLabel(Resource.getProperty("overalt.text.versionDescription"));
		build.add(label, newTextArea("versionDescription"));
		super.doBuildWindow(build);
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.syncsoft.overalt.gui.api.window.AbstractSendFileWindow#update(org.syncsoft.overalt.gui.api.WindowContextValue)
	 */
	@Override
	public void update(WindowContextValue context) {
		super.update(context);
		String title = context.getValue("title");
		getTextComponent("title").setText(title);
		
		String description = context.getValue("description");
		getTextComponent("description").setText(description);
	}
}
